<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TeacherSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Teachers';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="teacher-index">

    <?php Pjax::begin(); ?>
    <div class="panel">
		<div class="panel-heading panel-heading-auto">
            <?php echo $this->render('_search', ['model' => $searchModel]); ?>
		</div>
        <div class="panel-body">
            <p style="margin-bottom: 15px;">
                <?php //if($user->can('teacher/add')) {
                echo Html::a('新增', ['create'],['class'=>'btn btn-success']);
                //} ?>
            </p>

            <?= GridView::widget([
                'layout' => "{items}\n{pager}",
                'tableOptions' => ['class' => 'table table-hover table-bordered'],
                'dataProvider' => $dataProvider,
                //'filterModel' => $searchModel,
                'columns' => [
                    ['class' => 'yii\grid\SerialColumn', 'header' => '序号'],

                    //'ID',
                    //'XXID',
                    [
                        'attribute' => 'ZWMC',
                        'label' => '学校',
                        'value' => function ($model){ return $model->xX->ZWMC; },
                    ],
                    //'BMID',
                    //'ZYID',
                    [
                        'attribute' => 'GRID',
                        'label' => '姓名',
                        'value' => function ($model){ return $model->gR->name; },
                    ],
                    [
                        'attribute' => 'GRID',
                        'label' => '性别',
                        'value' => function ($model){ return $model->gR->sex; },
                    ],
                    [
                        'attribute' => 'GRID',
                        'label' => '身份证号',
                        'value' => function ($model){ return $model->gR->id_number; },
                    ],
                    'GH',
                    'GWMC',
                    'ZW',
                    'ZC',
                    'RZSJ',
                    //'LRSJ',
                    //'BZ',
                    'ZT',

                    [
                      'class' => 'yii\grid\ActionColumn',
                      'header'=>'操作',
                      // 'template' => '{view} {delete}',
                    ],
                      
                ],
            ]); ?>

		</div>
	</div>
    <?php Pjax::end(); ?>

</div>
